Contactless card emulation system and method

ABSTRACT

A system and method are described that enables mobile devices (e.g. including but not limited to a mobile phone or the like), to intercept and respond to contactless card authentication requests, allowing mobile devices to be used in place of contactless cards. Enabling mobile phone devices to emulate contactless cards decreases issues related to lost or damaged cards, enabling a single device to be used to provide tokens related to multiple different contactless cards, and leverages functionality of the mobile device to provide dual-factor authentication.

CROSS-REFERENCE TO RELATED APPLICATIONS

This application claims priority from U.S. Provisional Application No. 62/740,352, filed on Oct. 2, 2018, the disclosure of which is incorporated herein by reference in its entirety.

FIELD OF THE INVENTION

The present disclosure relates to cryptography, and more particularly, to systems and methods for the cryptographic authentication.

BACKGROUND

Data security and transaction integrity are of critical importance to businesses and consumers. As electronic transactions continue to increasingly dominate commercial activity, malicious parties continue to interfere with the electronic transactions to obtain valuable customer information for nefarious use. Accordingly, there is a need for improved authentication solutions that overcome security deficiencies and that may be used to control access to client information and accounts.

SUMMARY

Aspects of the disclosed technology include systems and methods for cryptographic authentication. In particular, systems and methods for emulating contactless card authentication are described that enable a user to use a mobile device in place of a contactless card for contactless card authentication at a transaction device.

According to one aspect, a device configured to emulate a contactless card includes a processor, a plurality of network interfaces including a contactless card interface and a non-volatile memory having contactless card emulation program code stored thereon. The contactless card emulation program code may be operable when executed upon by the processor to detect receipt of a contactless card authentication request received at the contactless card interface from a transaction device. The program may identify a contactless card associated with the contactless card authentication request, including retrieving, from a database storing information related to one or more contactless cards, a counter, a master key and a shared secret associated with the identified contactless card. The program may generate a response message, the response message including at least a portion of the shared secret, or at least a portion of the counter, or both. The program may generate a diversified key using at least a portion of the counter, the master key and one or more cryptographic algorithms, encode the response message by applying one or more cryptographic algorithms and the diversified key to the response message to yield a cryptogram response and transmit the cryptogram response to the transaction device over contactless card interface.

According to a another aspect, a method for emulating contactless card authentication by a client device includes intercepting a contactless card authentication request received by a contactless card interface of a client device from a transaction device, identifying a contactless card associated with the contactless card authentication request, retrieving, from a memory storing information associated with one or more contactless cards, a counter, a shared secret and a master key associated with the identified contactless card and generating a response message, the response message including at least a portion of the shared secret, or at least a portion of the counter, or both. The method includes generating a diversified key using at least a portion of the counter, the master key and one or more cryptographic algorithm, encoding the response message using one or more cryptographic algorithms and the diversified key to yield a cryptogram response and transmitting the cryptogram response to the transaction device over the contactless card interface.

According to further aspect, a method for using a mobile device in place of a contactless card for contactless card authentication is provided. The method includes the steps of storing information related to one or more contactless cards in a non-volatile memory of the mobile device, the information including, for each contactless card, a pair of device keys, a counter and a shared secret and intercepting a contactless card authentication request received at a contactless card interface of the mobile device from a transaction device. The method includes generating an encrypted cryptogram by identifying a contactless card associated with the contactless card authentication request. The method also includes retrieving the pair of device keys, the counter and the shared secret associated with the identified contactless card and generating a pair of session keys using on the pair of device keys and the counter. The method also includes generating a message using at least a portion of the shared secret, or at least a portion of the counter, or both. The method also includes encoding the message using a first session key of the pair of session keys to produce a cryptogram. The method also includes encrypting the cryptogram using a second session key of the pair of session keys to produce an encrypted cryptogram. The method also includes transmitting the encrypted cryptogram to the transaction device over the contactless card interface. The method also includes displaying, on a user interface of the mobile device, a status of the contactless card authentication request. Other embodiments of this aspect include corresponding computer systems, apparatus, and computer programs recorded on one or more computer storage devices, each configured to perform the actions of the methods.

Further features of the disclosed design, and the advantages offered thereby, are explained in greater detail hereinafter with reference to specific example embodiments illustrated in the accompanying drawings, wherein like elements are indicated with like reference designators.

BRIEF DESCRIPTION OF THE DRAWINGS

FIG. 1A is a diagram of a data transmission system according to an example embodiment.

FIG. 1B is a diagram illustrating a sequence for providing authenticated access according to an example embodiment.

FIG. 2 is a diagram of a data transmission system according to an example embodiment.

FIG. 3 is a diagram of a system using a mobile device according to an example embodiment.

FIG. 4 is an illustration of a mobile device according to an example embodiment.

FIG. 5 is an illustration depicting a message used to communicate with a device according to an example embodiment.

FIG. 6 is an illustration depicting a message and a message format according to an example embodiment.

FIG. 7 is a flowchart illustrating key operations according to an example embodiment.

FIG. 8 is a diagram of a key system according to an example embodiment.

FIG. 9 is a flowchart of a method of generating a cryptogram according to an example embodiment.

FIG. 10 is a flowchart illustrating a process of key diversification according to an example embodiment.

FIG. 11 is a flowchart illustrating exemplary steps that may be performed by a contactless card emulation process as disclosed herein; and

FIG. 12 is a flowchart illustrating exemplary steps that may be performed by of a contactless card emulation process as disclosed herein.

DETAILED DESCRIPTION OF EXAMPLE EMBODIMENTS

The following description of embodiments provides non-limiting representative examples referencing numerals to particularly describe features and teachings of different aspects of the invention. The embodiments described should be recognized as capable of implementation separately, or in combination, with other described embodiments. A person of ordinary skill in the art reviewing the description of embodiments should be able to learn and understand the different described aspects of the invention. The description of embodiments should facilitate understanding of the invention to such an extent that other implementations, not specifically covered but within the knowledge of a person of skill in the art having read the description of embodiments, would be understood to be consistent with an application of the invention.

According to one aspect, a mobile device includes program code for emulating the behavior of a contactless card, for example emulating the behavior of a contactless card that generates a dynamic cryptogram that may be used for authentication purposes. In particular, the emulation program code enables mobile devices (e.g. including but not limited to a mobile phone or the like), to intercept and responds to contactless card authentication requests, allowing mobile devices to be used in place of contactless cards. Enabling mobile phone devices to emulate contactless cards provides numerous advantages; for example, the size of contactless cards increases the potential that a card may become lost or damaged. When the contactless card is necessary for authentication of the user, a lost or damaged card may undesirably limit a user's ability to access accounts or perform transactions until a replacement card may be delivered.

Mobile devices, such as mobile phones, watches, tablets, etc. on the other hand, in addition to generally being larger and more robust than contactless cards, include additional technology that reduces the potential that the phone is lost. In the event that a mobile phone is lost, the mobile device interfaces (cellular, WIFI) may be used to locate the phone, reducing the potential that a lost phone is unrecoverable. Another advantage of using a mobile phone to emulate a contactless card is that the mobile phone may advantageously be configured for emulating multiple contactless cards. Information that is used to generate authentication tokens (including keys, counters, shared secrets, identifiers) may be stored in the memory of the mobile device, allowing the mobile phone to be used to emulate multiple different contactless cards, each of which may be used for different purposes. For example, in one embodiment, the mobile phone may be used to replace a contactless card that is used to authenticate a user prior to allowing access to a network. A separate contactless card emulation may support financial transactions of the user. Additional contactless cards may be used to support a variety of different authentication purposes, such as access to classified data, access to health information, etc.

In some embodiments, contactless card emulation program code monitors authentication requests received over interfaces generally used for contactless card transactions, such as Near Field Communication (NFC) interface, WIFI interfaces, Bluetooth interfaces and the like, although the present disclosure is not limited to the use of any particular interface for contactless card authentication token exchange.

According to one embodiment, the contactless card emulation program code may intercept communications and generate authentication tokens using systems and methods disclosed in U.S. Patent Application Serial Number U.S. patent application Ser. No. 16/205,119 filed Nov. 29, 2018, by Osborn, et al., entitled “Systems and Methods for Cryptographic Authentication of Contactless Cards” and incorporated herein by reference (hereinafter the '119 Application).

FIG. 1A illustrates a data transmission system according to an example embodiment. As further discussed below, system 100 may include mobile device 105, transaction device 110, network 115, and server 120. Although FIG. 1A illustrates single instances of the components, system 100 may include any number of components.

System 100 may include one or more mobile devices 105, which may include but are not limited to a mobile phone device or other mobile network enabled computer including at least a subset of the components explained below with reference to FIG. 5. According to one aspect, as described in more detail below, the mobile device 105 may be configured with contactless card emulation program code 101, enabling the mobile device 105 to generate an authentication cryptogram in response to a contactless card authentication request.

As referred to herein, a mobile network-enabled computer may include, but is not limited to a mobile computer device, or communications device including, e.g., a phone, a watch, a handheld PC, a personal digital assistant, or other device. The mobile device 105 may include an iPhone, iPod, iPad from Apple® or any other mobile device running Apple's iOS® operating system, any device running Microsoft's Windows® Mobile operating system, any device running Google's Android® operating system, and/or any other smartphone, tablet, or like wearable mobile device. In some embodiments, mobile device 105 may be in wireless communication, utilizing NFC in an example, with transaction device 110.

System 100 may include transaction device 110, which may be either a mobile network-enabled computer as described above, or alternatively a fixed location network-enabled computer. As referred to herein, a fixed location network-enabled computer may include, but is not limited to a computer device, or communications device including, e.g., a server, a network appliance, a personal computer, a workstation, a phone, a handheld PC, a personal digital assistant, a thin client, a fat client, an Internet browser, or other device. Transaction device 110 also may be a mobile device; for example, a mobile device may include an iPhone, iPod, iPad from Apple® or any other mobile device running Apple's iOS® operating system, any device running Microsoft's Windows® Mobile operating system, any device running Google's Android® operating system, and/or any other smartphone, tablet, or like wearable mobile device.

The mobile device 105 and transaction device 110 device may include a processor and a memory, and it is understood that the processing circuitry may contain additional components, including processors, memories, error and parity/CRC checkers, data encoders, anti-collision algorithms, controllers, command decoders, security primitives and tamper-proofing hardware, as necessary to perform the functions described herein. The transaction device 110 and/or mobile device 105 may further include a display and input devices. The display may be any type of device for presenting visual information such as a computer monitor, a flat panel display, and a mobile device screen, including liquid crystal displays, light-emitting diode displays, plasma panels, and cathode ray tube displays. The input devices may include any device for entering information into the user's device that is available and supported by the user's device, such as a touch-screen, keyboard, mouse, cursor-control device, touch-screen, microphone, digital camera, video recorder or camcorder. These devices may be used to enter information and interact with the software and other devices described herein.

In some examples, the mobile device 105 and/or transaction device 110 of system 100 may execute one or more applications, such as software applications, that enable network communications with one or more components of system 100, such as a transaction device 110 or other server coupled to network 115.

Transaction device 110 may be in communication with one or more servers 120 via one or more networks 115 and may operate as a respective front-end to back-end pair with server 120. Transaction device 110 may transmit one or more requests to server 120. The one or more requests to the server 120, including but not limited to authentication requests. Server 120 may receive the one or more requests from transaction device 110. Based on the one or more requests from transaction device 110, server 120 may be configured to retrieve data from one or more databases (not shown) for use in generating a response to the request from the transaction device 110.

System 100 may include one or more networks 115. In some examples, network 115 may be one or more of a wireless network, a wired network or any combination of wireless network and wired network and may be configured to connect transaction device 110 to server 120. For example, network 115 may include one or more of a fiber optics network, a passive optical network, a cable network, an Internet network, a satellite network, a wireless local area network (LAN), a Global System for Mobile Communication, a Personal Communication Service, a Personal Area Network, Wireless Application Protocol, Multimedia Messaging Service, Enhanced Messaging Service, Short Message Service, Time Division Multiplexing based systems, Code Division Multiple Access based systems, D-AMPS, Wi-Fi, Fixed Wireless Data, IEEE 802.11b, 802.15.1, 802.11n and 802.11g, Bluetooth, NFC, Radio Frequency Identification (RFID), Wi-Fi, and/or the like.

In addition, network 115 may include, without limitation, telephone lines, fiber optics, IEEE Ethernet 902.3, a wide area network, a wireless personal area network, a LAN, or a global network such as the Internet. In addition, network 115 may support an Internet network, a wireless communication network, a cellular network, or the like, or any combination thereof. Network 115 may further include one network, or any number of the exemplary types of networks mentioned above, operating as a stand-alone network or in cooperation with each other. Network 115 may utilize one or more protocols of one or more network elements to which they are communicatively coupled. Network 115 may translate to or from other protocols to one or more protocols of network devices. Although network 115 is depicted as a single network, it should be appreciated that according to one or more examples, network 115 may comprise a plurality of interconnected networks, such as, for example, the Internet, a service provider's network, a cable television network, corporate networks, such as credit card association networks, and home networks.

As described above, system 100 may include one or more servers 120. In some examples, server 120 may include one or more processors, which are coupled to memory. Server 120 may be configured as a central system, server or platform to control and call various data at different times to execute a plurality of workflow actions. Server 120 may be configured to connect to the one or more databases. Server 120 may be connected to at least one transaction device 110.

FIG. 1B is a timing diagram illustrating exemplary steps of one method for providing authenticated access according to one or more embodiments of the present disclosure. System 100 may comprise mobile device 105 including emulation program code 101 stored in memory thereon and accessible by a processor 103 to intercept contactless card authentication requests and to perform a cryptogram generation function. The system 100 is shown to also include a transaction device 110, which may include an application 122 and processor 124.

At step 102, the application 122 communicates with the mobile device 105 (e.g., after being brought near the mobile device 105). In some embodiments, such communication may include the application 122 communicating with one or more applications on the mobile device, for example to display a prompt on a user interface of the mobile device 105 to cause a user to move the mobile device 105 into proximity with the transaction device 110.

Communication between the transaction device 110 and the mobile device 105 may be performed using NFC communication channels. Communication between the application 122 and the mobile device 105 may involve the mobile device 105 being sufficiently close to a card reader (not shown) of the transaction device 110 to enable NFC data transfer between the application 122 and the mobile device 105.

At step 104, after communication has been established between transaction device 110 and mobile device 105, the emulation program code 101 executing on the mobile device 105 intercepts a contactless card authentication request and generates a message authentication code (MAC) cryptogram. In some examples, this may occur when the application 122 reads or otherwise forwards an application associated with a contactless card applet which is intercepted by the emulation program code 101 of the mobile device 105.

In one embodiment, this may occur upon the transaction device 110 issuing a read, such as an NFC read, of a near field data exchange (NDEF) tag, which may be created in accordance with the NFC Data Exchange Format. For example, a reader, such as application 122, may transmit a message, such as an application select message, with the application ID of an NDEF producing application known to be associated with a contactless card cryptogram authentication applet. The NDEF read is intercepted by emulation program code 101. The emulation program code of the mobile device may confirmation of the selection of the NDEF read, causing the transaction device 110 to issue transmit a sequence of select file messages followed by read file messages. For example, the sequence of select messages may be transmitted from the transaction device 110 to the mobile device 105, the series of messages including “Select Capabilities file”, “Read Capabilities file”, and “Select NDEF file”. Each of these messages may be intercepted by the emulation program code. Following identification of the appropriate NDEF file, the transaction device 110 may then forward a “Read NDEF file” message to the mobile device 105.

Upon receipt of a “Select NDEF file” that requests a cryptogram from application 101, the emulation program code may identify the particular contactless card associated with the NDEF read. In one embodiment, the mobile device may store information related to a plurality of contactless cards, including but not limited to a counter, a shared secret and a master key. (??) The emulation program code may identify the particular contactless card to use for the transaction, either by extracting or inferring the contactless card identifier from the NDEF read, or alternatively in response to selection of a contactless card by a user at a user interface of the mobile device. The emulation program code retrieves the counter, shared secret and master key associated with the identified contactless card, and updates or increments the counter value associated with the card and maintained by the mobile device 105. In response to receipt of the “Read NDEF file” by the emulation program code 101, the mobile device 105 may generate a message including a header and the shared secret. In one embodiment, the emulation program code 101 may then generate one or more session keys, and a MAC cryptogram may be created from the message, which, as described, may include the header and the shared secret. The MAC cryptogram may then be concatenated with one or more blocks of random data, and the MAC cryptogram and a random number (RND) may be encrypted with the session key. Thereafter, the cryptogram and the header may be concatenated, and encoded as ASCII hex, packaged by the emulation program code 101 in NDEF message format (responsive to the “Read NDEF file” message).

In some examples, the MAC cryptogram may be transmitted as an NDEF tag, and in other examples the MAC cryptogram may be included with a uniform resource indicator (e.g., as a formatted string).

In some examples, application 122 may be configured to transmit a request to a contactless card, which is intercepted by mobile device 105, the request comprising an instruction to generate a MAC cryptogram. The emulation program code 101 may generate the cryptogram as described.

At step 106, the mobile device 105 sends the MAC cryptogram to the application 122. In some examples, the transmission of the MAC cryptogram occurs via NFC, however, the present disclosure is not limited thereto. In other examples, this communication may occur via Bluetooth, Wi-Fi, or other means of wireless data communication.

At step 108, the application 122 communicates the MAC cryptogram to the processor 124.

At step 112, the processor 124 verifies the MAC cryptogram pursuant to an instruction from the application 122. For example, the MAC cryptogram may be verified, as explained below.

In some examples, verifying the MAC cryptogram may be performed by a device other than transaction device 110, such as a server 120 in data communication with the transaction device 110 (as shown in FIG. 1A). For example, processor 124 may output the MAC cryptogram for transmission to server 120, which may verify the MAC cryptogram.

In some examples, the MAC cryptogram may function as a digital signature for purposes of verification. Other digital signature algorithms, such as public key asymmetric algorithms, e.g., the Digital Signature Algorithm and the RSA algorithm, or zero knowledge protocols, may be used to perform this verification.

FIG. 2 illustrates a data transmission system according to an example embodiment. System 200 may include a transmitting or sending device 205, a receiving or recipient device 210 in communication, for example via network 215, with one or more servers 220. Transmitting or sending device 205 may be the same as, or similar to, mobile device 105 executing emulation program code 101 as discussed above with reference to FIG. 1A. Receiving or recipient device 210 may be the same as, or similar to, transaction device 110 discussed above with reference to FIG. 1A. Network 215 may be similar to network 115 discussed above with reference to FIG. 1A. Server 220 may be similar to server 120 discussed above with reference to FIG. 1A. Although FIG. 2 shows single instances of components of system 200, system 200 may include any number of the illustrated components.

When using symmetric cryptographic algorithms, such as encryption algorithms, hash-based message authentication code (HMAC) algorithms, and cipher-based message authentication code (CMAC) algorithms, it is important that the key remain secret between the party that originally processes the data that is protected using a symmetric algorithm and the key, and the party who receives and processes the data using the same cryptographic algorithm and the same key.

It is also important that the same key is not used too many times. If a key may be used or reused too frequently, that key may be compromised. Each time the key may be used, it provides an attacker an additional sample of data which was processed by the cryptographic algorithm using the same key. The more data which the attacker has which was processed with the same key, the greater the likelihood that the attacker may discover the value of the key. A key used frequently may be comprised in a variety of different attacks.

Moreover, each time a symmetric cryptographic algorithm is executed, it may reveal information, such as side-channel data, about the key used during the symmetric cryptographic operation. Side-channel data may include minute power fluctuations which occur as the cryptographic algorithm executes while using the key. Sufficient measurements may be taken of the side-channel data to reveal enough information about the key to allow it to be recovered by the attacker. Using the same key for exchanging data would repeatedly reveal data processed by the same key.

However, by limiting the number of times a particular key may be used, the amount of side-channel data which the attacker is able to gather is limited and thereby reduces exposure to this and other types of attack. As further described herein, the parties involved in the exchange of cryptographic information (e.g., sender and recipient) may independently generate keys from an initial shared master symmetric key in combination with a counter value, and thereby periodically replace the shared symmetric key being used with needing to resort to any form of key exchange to keep the parties in sync. By periodically changing the shared secret symmetric key used by the sender and the recipient, the attacks described above are rendered impossible.

Referring back to FIG. 2, system 200 may be configured to implement key diversification. For example, a sender and recipient may desire to exchange data (e.g., original sensitive data) via respective devices 205 and 210. As explained above, although single instances of transmitting device 205 and receiving device 210 may be included, it is understood that one or more transmitting devices 205 and one or more receiving devices 210 may be involved so long as each party shares the same shared secret symmetric key. In some examples, the transmitting device 205 and receiving device 210 may be provisioned with the same master symmetric key. Further, it is understood that any party or device holding the same secret symmetric key may perform the functions of the transmitting device 205 and similarly any party holding the same secret symmetric key may perform the functions of the receiving device 210. In some examples, the symmetric key may comprise the shared secret symmetric key which is kept secret from all parties other than the transmitting device 205 and the receiving device 210 involved in exchanging the secure data. It is further understood that both the transmitting device 205 and receiving device 210 may be provided with the same master symmetric key, and further that part of the data exchanged between the transmitting device 205 and receiving device 210 comprises at least a portion of data which may be referred to as the counter value. The counter value may comprise a number that changes each time data is exchanged between the transmitting device 205 and the receiving device 210. In one embodiment, the transmitting device 205 and receiving device (and/or the server 220) may each store a copy of the counter value, which is updated independently by each device in response to a predetermined counter update protocol. As described above, when the transmitting device is a mobile device 105 executing emulation program code 101, the mobile device may store information related to a plurality of contactless cards, including counters, shared secrets and one or more keys for each contactless card.

System 200 may include one or more networks 215. In some examples, network 215 may be one or more of a wireless network, a wired network or any combination of wireless network and wired network and may be configured to connect one or more transmitting devices 205 and one or more receiving devices 210 to server 220. For example, network 215 may include one or more of a fiber optics network, a passive optical network, a cable network, an Internet network, a satellite network, a wireless LAN, a Global System for Mobile Communication, a Personal Communication Service, a Personal Area Network, Wireless Application Protocol, Multimedia Messaging Service, Enhanced Messaging Service, Short Message Service, Time Division Multiplexing based systems, Code Division Multiple Access based systems, D-AMPS, Wi-Fi, Fixed Wireless Data, IEEE 802.11b, 802.15.1, 802.11n and 802.11g, Bluetooth, NFC, RFID, Wi-Fi, and/or the like.

In addition, network 215 may include, without limitation, telephone lines, fiber optics, IEEE Ethernet 902.3, a wide area network, a wireless personal area network, a LAN, or a global network such as the Internet. In addition, network 215 may support an Internet network, a wireless communication network, a cellular network, or the like, or any combination thereof. Network 215 may further include one network, or any number of the exemplary types of networks mentioned above, operating as a stand-alone network or in cooperation with each other. Network 215 may utilize one or more protocols of one or more network elements to which they are communicatively coupled. Network 215 may translate to or from other protocols to one or more protocols of network devices. Although network 215 is depicted as a single network, it should be appreciated that according to one or more examples, network 215 may comprise a plurality of interconnected networks, such as, for example, the Internet, a service provider's network, a cable television network, corporate networks, such as credit card association networks, and home networks.

In some examples, one or more transmitting devices 205 and one or more receiving devices 210 may be configured to communicate and transmit and receive data between each other without passing through network 215. For example, communication between the one or more transmitting devices 205 and the one or more receiving devices 210 may occur via at least one of NFC, Bluetooth, RFID, Wi-Fi, and/or the like.

At block 225, when the transmitting device 205 is preparing to process the sensitive data with symmetric cryptographic operation, the sender may update the copy of the counter associated with the identified contactless card that is selected for use in authentication. In addition, the transmitting device 205 may select an appropriate symmetric cryptographic algorithm, which may include at least one of a symmetric encryption algorithm, HMAC algorithm, and a CMAC algorithm. In some examples, the symmetric algorithm used to process the diversification value may comprise any symmetric cryptographic algorithm used as needed to generate the desired length diversified symmetric key. Non-limiting examples of the symmetric algorithm may include both encryption algorithms, hash algorithms, or a combination thereof. For example, a symmetric encryption algorithm such as 3DES or AES128 may be used. Symmetric hash algorithms include but are not limited to the HMAC algorithm, such as HMAC-SHA-256 or a symmetric CMAC algorithm such as AES-CMAC. It is understood that if the output of the selected symmetric algorithm does not generate a sufficiently long key, techniques such as processing multiple iterations of the symmetric algorithm with different input data and the same master key may produce multiple outputs which may be combined as needed to produce sufficient length keys.

At block 230, the transmitting device 205 may take the selected cryptographic algorithm, and using the master symmetric key, process the counter value to generate a diversified symmetric key. For example, the sender may select a symmetric encryption algorithm, and use a counter which updates with every conversation between the transmitting device 205 and the receiving device 210. The transmitting device 205 may then encrypt or hash the counter value with the selected symmetric encryption/hash algorithm using the master symmetric key, creating a diversified symmetric key. In some embodiments, the counter value may itself comprise the diversified symmetric key

At block 235, the diversified symmetric key may be used to process the sensitive data to provide a cryptogram, before transmitting the cryptogram to the receiving device 210. For example, the transmitting device 205 may encrypt or hash the sensitive data using a symmetric encryption/hash algorithm using the diversified symmetric key, producing a cryptogram comprising protected encrypted or hashed data. The transmitting device 205 may then transmit the cryptogram to the receiving device 210 for cryptogram validation.

Cryptogram validation may be performed by an authentication server such as server 220, or by a receiving device 210, which may be, for example, a merchant transaction device 210 or any network enabled computer comprising cryptogram validation logic as described below. In FIG. 2, cryptogram validation is described as performed by receiving device 210.

At block 240, the receiving device 210 may first take its stored copy of the counter value and stored copy of its master symmetric key, and then perform the same symmetric encryption and/or hash function to generate a copy of the diversified key. Provided that the counters are synchronized, the output of the encryption/hash provides the same diversified symmetric key for both the receiving device 210 and the transmitting device 205.

Depending upon whether encryption or hashing may be used, the receiving device may authenticate the cryptogram in one of two ways. In the event that the cryptogram comprises encrypted information, at block 250 the receiving device 210 may decrypt the protected encrypted data using a symmetric decryption algorithm along with the generated diversified symmetric key, to extract the header/shared secret, counter or other information stored as part of the cryptogram message.

The receiving device may then compare the decrypted counter and/or decrypted header, shared secret message against an expected counter or header/shared secret message associated with the transmitting device 205. A match between the expected counter and/or expected shared secret and the shared secret and/or counter exposed following decryption occurs when diversified keys match, which establishes that both the transmitting device 205 and receiving device 210 have knowledge both of the master keys and the updated counter values.

In some embodiments, the diversified keys may be used to hash the message (header, shared secret) generated by the transmitting device 205, and in such systems the cryptogram may comprise a hashed result. Hashed results may provide increased security as they may not be decrypted to expose sensitive content. In such systems, at step 235, the transmitting device 205 transmits the hashed cryptogram to receiving device 210. As described above, the receiving device at step 240 may take its stored copy of the counter value and stored copy of its master symmetric key, and then perform the same symmetric encryption and/or hash function to generate a diversified key copy. The diversified key copy may be used to generate an expected hashed cryptogram, for example, by applying the HMAC or other symmetric hashing function to an expected shared secret and header for the message. The expected hashed cryptogram may then be compared against the received cryptogram to determine a match, which establishes that both the transmitting device 205 and receiving device 210 have knowledge of both the master key and the appropriate counter value. In some embodiments, the hashed cryptogram may be encrypted prior to transmission, and decrypted following transmission and before the hash compare for increased security.

When sensitive data is next sent from the sender to the recipient via respective transmitting device 205 and receiving device 210, a different counter value may be selected to produce a different diversified symmetric key. By processing the counter value with the master symmetric key and same symmetric cryptographic algorithm, both the transmitting device 205 and receiving device 210 may independently produce the same diversified symmetric key. This diversified symmetric key, not the master symmetric key, may be used to protect the sensitive data. Because the diversified symmetric key is independently created by both the transmitting device 205 and receiving device 210, it is never transmitted between the two parties. Thus, an attacker may not intercept the diversified symmetric key and the attacker never sees any data which was processed with the master symmetric key. Only the counter value is processed with the master symmetric key, not the sensitive data. As a result, reduced side-channel data about the master symmetric key is revealed. Moreover, the operation of the transmitting device 205 and the receiving device 210 may be governed by symmetric requirements for how often to create a new diversification value, and therefore a new diversified symmetric key. In an embodiment, a new diversification value and therefore a new diversified symmetric key may be created for every exchange between the transmitting device 205 and receiving device 210.

In some examples, the key diversification value may comprise the counter value. Other non-limiting examples of the key diversification value include: a random nonce generated each time a new diversified key is needed, the random nonce sent from the transmitting device 205 to the receiving device 210; the full value of a counter value sent from the transmitting device 205 and the receiving device 210; a portion of a counter value sent from the transmitting device 205 and the receiving device 210; a counter independently maintained by the transmitting device 205 and the receiving device 210 but not sent between the two devices; a one-time-passcode exchanged between the transmitting device 205 and the receiving device 210; and a cryptographic hash of the sensitive data. In some examples, one or more portions of the key diversification value may be used by the parties to create multiple diversified keys. For example, a counter may be used as the key diversification value. Further, a combination of one or more of the exemplary key diversification values described above may be used.

In another example, a portion of the counter may be used as the key diversification value. If multiple master key values are shared between the parties, the multiple diversified key values may be obtained by the systems and processes described herein. A new diversification value, and therefore a new diversified symmetric key, may be created as often as needed. In the most secure case, a new diversification value may be created for each exchange of sensitive data between the transmitting device 205 and the receiving device 210. In effect, this may create a one-time use key, such as a single-use session key.

In other examples, such as to limit the number of times of use of the master symmetric key, it may be agreed upon by the sender of transmitting device and recipient of the receiving device that a new diversification value, and therefore a new diversified symmetric key, may happen only periodically. In one example, this may be after a pre-determined number of uses, such as every 10 transmissions between the transmitting device and the receiving device. In another example, this may be after a certain time period, a certain time period after a transmission, or on a periodic basis (e.g., daily at a designated time; weekly at a designated time on a designated day). In another example, this may be every time the receiving device signals to the transmitting device that it desires to change the key on the next communication. This may be controlled on policy and may be varied due to, for example, the current risk level perceived by the recipient of the receiving device.

FIG. 3 illustrates a system 300 using a mobile device 105 including contactless card emulation program code 101 configured to intercept contactless card authentication requests and to provide a cryptogram for authentication purposes as described with regard to FIG. 2. System 300 may include a mobile device 305, one or more transaction devices 310, network 315, servers 320, 325, one or more hardware security modules 330, and a database 335. Although FIG. 3 illustrates single instances of the components, system 300 may include any number of components.

Mobile devices 305 may be, for example, a phone, watch or other portable, network enabled computing device. In some examples, mobile device 305 may be in wireless communication, for example NFC communication, with transaction device 310 via a contactless card interface. For example, mobile device 305 may comprise one or more chips, such as a radio frequency identification chip, configured to communication via NFC or other short-range protocols. In other embodiments, mobile device 305 may communicate with transaction device 310 through other means including, but not limited to, Bluetooth, satellite, Wi-Fi, wired communications, and/or any combination of wireless and wired connections. According to some embodiments, mobile device 305 may be configured to communicate with cryptogram reader 313 of transaction device 310 through NFC when mobile device 305 is within range of cryptogram reader 313. In other examples, communications with mobile device 305 may be accomplished through a physical interface, e.g., a universal serial bus interface or a card swipe interface. Emulation program code 301 of the mobile device 305 may be configured to monitor communications received over the contactless card interface, intercept contactless card authentication requests and generate authentication cryptograms in response.

System 300 may include transaction device 310, which may be a network-enabled computer. In some examples, the transaction device 310 may be the same as, or similar to, a transaction device 110 as described with reference to FIG. 1A or FIG. 1B.

Transaction device 310 may be in communication with one or more servers 320 and 325 via one or more networks 315. Transaction device 310 may transmit, for example from an application 311 executing on transaction device 310, one or more requests to one or more servers 320 and 325. The one or more requests may be associated with retrieving data from one or more servers 320 and 325. Servers 320 and 325 may receive the one or more requests from transaction device 310. Based on the one or more requests from transaction device 310, one or more servers 320 and 325 may be configured to retrieve the requested data from one or more databases 335. Based on receipt of the requested data from the one or more databases 335, one or more servers 320 and 325 may be configured to transmit the received data to transaction device 310, the received data being responsive to one or more requests.

System 300 may include one or more hardware security modules (HSM) 330. For example, one or more HSMs 330 may be configured to perform one or more cryptographic operations as disclosed herein. In some examples, one or more HSMs 330 may be configured as special purpose security devices that are configured to perform the one or more cryptographic operations. The HSMs 330 may be configured such that keys are never revealed outside the HSM 330, and instead are maintained within the HSM 330. For example, one or more HSMs 330 may be configured to perform at least one of key derivations, decryption, and MAC operations. The one or more HSMs 330 may be contained within, or may be in data communication with, servers 320 and 325.

System 300 may include one or more networks 315. In some examples, network 315, similar to network 215 of FIG. 2, may comprise one or more of a wireless network, a wired network or any combination of wireless network and wired network and may be configured to connect client device 315 to server 320 and 325. As a non-limiting example, communications from mobile device 305 and transaction device 310 may comprise NFC communication, cellular network between transaction device 310 and a carrier, and Internet between the carrier and a back-end. Network 315 may further include one network, or any number of the exemplary types of networks mentioned previously herein, operating as a stand-alone network or in cooperation with each other. Network 315 may utilize one or more protocols of one or more network elements to which they are communicatively coupled. Network 315 may translate to or from other protocols to one or more protocols of network devices. Although network 315 is depicted as a single network, it should be appreciated that according to one or more examples, network 315 may comprise a plurality of interconnected networks, such as, for example, the Internet, a service provider's network, a cable television network, corporate networks, such as credit card association networks, and home networks.

In various examples according to the present disclosure, transaction device 310 of system 300 may execute one or more applications 311, and include one or more processors 312, and one or more cryptogram readers 313. For example, one or more applications 311, such as software applications, may be configured to enable, for example, network communications with one or more components of system 300 and transmit and/or receive data. It is understood that although only single instances of the components of transaction device 310 are illustrated in FIG. 3, any number of devices 310 may be used. Cryptogram reader 313 may be configured to read from and/or communicate with a mobile device 305 and/or a contactless card as described in the '119 Application. In conjunction with the one or more applications 311, cryptogram reader 313 may communicate with mobile device 305.

The application 311 of any of transaction device 310 may communicate with the mobile device 305 using short-range wireless communication (e.g., NFC). The application 311 may be configured to interface with a cryptogram reader 313 of transaction device 310 configured to communicate with a mobile device 305. As should be noted, those skilled in the art would understand that a distance of less than twenty centimeters is consistent with NFC range.

In some embodiments, the application 311 communicates through an associated reader (e.g., cryptogram reader 313) with the mobile device 305.

In some embodiments, the emulation program code 301 of the mobile device 305 may be activated for use as a provider of cryptogram authentication tokens related to a particular contactless card prior to its first use as an authentication source. Activation may be achieved in a variety of manners. For example, the activation may occur upon download of the emulation program code 101 from a service provider website, where the service provider may be any service provider that uses cryptograms such as those disclosed herein for authentication purposes.

In other embodiments, activation may occur upon first use of the emulation program code 101 by the mobile device 305 for cryptogram authentication. For example, a mobile device 305 may communicate with the application 311 through the cryptogram reader 313 of the transaction device 310 through NFC. The communication (e.g., a tap or other movement of the mobile device 105 proximate the cryptogram reader 313 of the transaction device 310) allows the application 311 to read the data associated with the mobile device 305 and enable use of the mobile device as an authentication source. In some cases, detection of a mobile device 305 including emulation program code 301 may activate or launch application 311 and then initiate one or more actions or communications with an account server 325 to activate the mobile device 305 for subsequent use as an authentication source. In some cases, if the application 311 is not installed on transaction device 310, a tap or other movement of the mobile device 305 including emulation program code 301 against or proximate to the cryptogram reader 313 may initiate a download of the application 311 (e.g., navigation to an application download page). Subsequent to installation, a tap or other movement of the mobile device 305 may activate or launch the application 311, and then initiate (e.g., via the application or other back-end communication) activation of the mobile device 305 for cryptogram authentication token use. After activation, the mobile device 305 may be used in various transactions, including commercial transactions.

Server 320 may comprise a web server in communication with database 335. Server 325 may comprise an account server. In some examples, server 320 may be configured to validate one or more credentials from mobile device 305 and/or transaction device 310 by comparison with one or more credentials in database 335. Server 325 may be configured to authorize one or more requests, such as payment and transaction, from mobile device 305 and/or transaction device 310.

FIG. 4 is a block diagram of representative components of a mobile phone or other NFC capable mobile device 400 including emulation program code 432 configured to support cryptogram authentication as disclosed herein. The components include network interface logic 440, one or more processors 410, a memory 430, User Interface control logic 435, network interface logic 440 and sensor control 450 coupled via system bus 420.

Each of the components performs particular functions using hardware, software or a combination thereof. Processor(s) 410 may comprise various hardware elements, software elements, or a combination of both. Examples of hardware elements may include devices, logic devices, components, processors, microprocessors, circuits, processor circuits, circuit elements (e.g., transistors, resistors, capacitors, inductors, and so forth), integrated circuits, application specific integrated circuits (ASIC), programmable logic devices (PLD), digital signal processors (DSP), field programmable gate array (FPGA), Application-specific Standard Products (ASSPs), System-on-a-chip systems (SOCs), Complex Programmable Logic Devices (CPLDs), memory units, logic gates, registers, semiconductor device, chips, microchips, chip sets, and so forth. Examples of software elements may include software components, programs, applications, computer programs, application programs, system programs, software development programs, machine programs, operating system software, middleware, firmware, software modules, routines, subroutines, functions, methods, procedures, processes, software interfaces, application program interfaces (API), instruction sets, computing code, computer code, code segments, computer code segments, words, values, symbols, or any combination thereof. Determining whether an embodiment is implemented using hardware elements and/or software elements may vary in accordance with any number of factors, such as desired computational rate, power levels, heat tolerances, processing cycle budget, input data rates, output data rates, memory resources, data bus speeds and other design or performance constraints, as desired for a given implementation.

Memory 430 may comprise a computer-readable storage medium to store program code configured to perform various functions. For example, the program code may include operating system program code 433 to control the general operation of the mobile device 400, including controlling network and user interfaces, display of content and allocating resources to one or more applications supported by the application program code 434. User interface control logic 435 may comprise a combination of hardware and software components that cooperate with program code to display, solicit and/or interpret information received from applications and network and user interfaces, such as displays and touchscreens. The user interface control logic 435, for example, may provide prompts to solicit user input, and may interpret user input received from graphical user interface elements such as buttons, menus, icons, tabs, windows, widgets etc. that may be displayed on a user display under control of a display control screen of the mobile device 400.

Examples of a computer-readable storage medium may include any tangible media capable of storing electronic data, including volatile memory or non-volatile memory, removable or non-removable memory, erasable or non-erasable memory, writeable or re-writeable memory, and so forth. Program code may include executable computer program instructions implemented using any suitable type of code, such as source code, compiled code, interpreted code, executable code, static code, dynamic code, object-oriented code, visual code, and the like. Embodiments may also be at least partly implemented as instructions contained in or on a non-transitory computer-readable medium, which may be read and executed by one or more processors to enable performance of the operations described herein.

Emulation program code 432 comprises program code as disclosed herein for intercepting contactless card authentication requests and generating a cryptogram for use in authenticating the mobile device 400 as disclosed herein. The emulation program code 432 may be used for a variety of purposes. For example, a mobile device 400 including cryptogram generation capability may be used to validate the identity of the user prior to allowing the user to access a resource. For example, mobile devices such as those described herein may be used in replace of a Common Access Cards (CAC), in place of key fobs, contactless cards, etc. Memory 430 may store data contactless card information for one or more contactless cards for use by the emulation program code 432, including, for each contactless card, one or more key(s) 460 and at least one counter 462 and a shared secret 464. Other information, including a shared secret 464 and/or a unique customer identifier 466 (pUID) may also be stored in memory 430 for use by the emulation program code 432. The one or more counters 462 may comprise a numeric counter sufficient to store an integer. The customer identifier (pUID) 466 may comprise a unique alphanumeric identifier assigned to a user of the mobile device 400, and the identifier may distinguish the user of the mobile device from other mobile device users. In some examples, the customer identifier 466 may identify both a customer and an account assigned to that customer and may further identify the mobile device associated with the customer's account.

As described above, in one embodiment the emulation program code 432 may be configured to intercept and respond to one or more requests, such as near field data exchange requests, from a reader, such as a mobile NFC reader, and produce an NDEF message that comprises a cryptographically secure One Time Password (OTP) encoded as an NDEF text tag.

The system bus 420 provides an interface for system components including, but not limited to, the memory 430 and to the processors 410. The system bus 420 may be any of several types of bus structure that may further interconnect to a memory bus (with or without a memory controller), a peripheral bus, and a local bus using any of a variety of commercially available bus architectures.

Network Interface logic includes transmitters, receivers, and controllers configured to support various known protocols associated with different forms of network communications. Example network interfaces that may be included in a mobile phone implementing the methods disclosed herein include, but are not limited to a WIFI interface 442, an NFC interface 444, a Bluetooth Interface 446 and a Cellular Interface 448.

Sensor control 450 comprises a subset of sensors that may support the position alignment methods disclosed herein, including camera(s) 452, including camera technology for capturing two dimensional and three dimensional light based or infrared images. The sensor control 450 may also include one or more biometric sensors 458. In some embodiments, one or both of the cameras 452 and biometric sensors 458 may provide a second factor of authentication that may be used in conjunction with the cryptogram authentication token to provide dual factor authentication using the mobile device 400.

FIG. 5 illustrates NDEF short-record layout (SR=1) 500 according to an example embodiment. The emulation program code may be configured to encode the OTP as an NDEF type 4 well known type text tag. In some examples, NDEF messages may comprise one or more records. The emulation program code may be configured to add one or more static tag records in addition to the OTP record. Exemplary tags include, without limitation, Tag type: well-known type, text, encoding English (en); Application ID: D2760000850101; Capabilities: read-only access; Encoding: the authentication message may be encoded as ASCII hex; type-length-value (TLV) data may be provided as a personalization parameter that may be used to generate the NDEF message. In an embodiment, the authentication template may comprise the first record, with a well-known index for providing the actual dynamic authentication data.

FIG. 6 illustrates a message 610 and a message format 620 according to an example embodiment. In one example, if additional tags are to be added, the first byte may change to indicate message begin, but not end, and a subsequent record may be added. Because ID length is zero, ID length field and ID are omitted from the record. An example message may include: UDK AUT key; Derived AUT session key (using 0x00000050); Version 1.0; pATC=0x00000050; RND=4838FB7DC171B89E; MAC=<eight computed bytes>.

In some examples, data may be stored in the mobile device at personalization time by implementing STORE DATA (E2) under secure channel protocol 2. One or more values may be read by the personalization bureau from the EMBOSS files (in a section designated by the Application ID) and one or more store data commands may be transmitted to the mobile device after authentication and secure channel establishment.

In other embodiments, the variables used by the emulation program code of the mobile device for cryptogram authentication may be populated by a service provider that utilizes cryptograms for authentication purposes. In such embodiments, application variables may be populated at an application layer level, wherein a client side application communicates with a server side application to populate the variables for cryptogram authentication prior to first use.

Length Item (bytes) Encrypted? Notes pUID 8 No AutKey 16 Yes 3DES Key for Deriving MAC session keys AutKCV 3 No Key Check Value DEKKey 16 Yes 3DES Key for deriving Encryption session key DEKKCV 3 No Key Check Value Card Shared 4 bytes No 4 Byte True Random number Random (pre-generated) NTLV X Bytes No TLV data for NDEF message

In some examples, the cryptogram provided by the emulation program code may be configured to emulate an RFID tag. The RFID tag may include one or more polymorphic tags. In some examples, each time the tag is read, different cryptographic data is presented that may indicate the authenticity of the mobile device. Based on the one or more applications, an NFC read of the tag may be processed, the token may be transmitted to a server, such as a backend server, and the token may be validated at the server.

In some embodiments, the one or more counters may be configured to prevent a replay attack. For example, if a cryptogram has been obtained and replayed, that cryptogram is immediately rejected if the counter has been read or used or otherwise passed over. If the counter has not been used, it may be replayed. In some examples, the counter that is updated on the card is different from the counter that is updated for transactions.

FIG. 7 is a flowchart illustrating exemplary steps of a process 700 that may be performed by the emulation program code to encode cryptograms according to an example embodiment. As illustrated in FIG. 7, at block 710, two bank identifier number (BIN) level master keys may be used in conjunction with the account identifier and customer identifier (pUID) to produce two unique derived keys (UDKs) per mobile device. In some examples, a bank identifier number may comprise one number or a combination of one or more numbers, such as an account number or an unpredictable number provided by one or more servers, may be used for session key generation and/or diversification. The UDKs (AUTKEY and ENCKEY) may be stored in the memory of the mobile device (for example 400, FIG. 4) during the personalization process.

At block 720, the counter may be used as the diversification data, since it changes with each use and provides a different session key each time, as opposed to the master key derivation in which one unique set of keys per card is produced. In some examples, it is preferable to use the 4-byte method for both operations. Accordingly, at block 720, two session keys may be created for each transaction from the UDKs, i.e., one session key from AUTKEY and one session key from ENCKEY. In one embodiment, the session key created from AUTKEY may use the low order of two bytes of the OTP counter for diversification. For the ENC key (i.e., the session key created from ENCKEY), the full length of the OTP counter may be used for the ENC key.

At block 730, the MAC key may be used for preparing the MAC cryptogram, and the ENC key may be used to encrypt the cryptogram. For example, the MAC session key may be used to hash data to produce the cryptogram, and the result may be encrypted with the ENC key before it is transmitted to the one or more servers.

At block 740, verification and processing of the MAC is simplified because 2-byte diversification is directly supported in the MAC authentication functions of payment HSMs. Decryption of the cryptogram is performed prior to verification of the MAC. The session keys are independently derived at the one or more servers, resulting in a first session key (the ENC session key) and a second session key (the MAC session key). The second derived key (i.e., the ENC session key) may be used to decrypt the data, and the first derived key (i.e., the MAC session key) may be used to verify the decrypted data.

For the mobile device, a different unique identifier may be derived which may be related to the application primary account number (PAN) and PAN sequence number, which may be encoded and stored in the memory of the mobile device for an associated contactless card authentication account. The key diversification may be configured to receive the identifier as input with the master key such that one or more keys may be created for each mobile device. In some examples, these diversified keys may comprise a first key and a second key. The first key may include an authentication master key (Card Cryptogram Generation/Authentication Key—Card-Key-Auth) and may be further diversified to create a MAC session key used when generating and verifying a MAC cryptogram. The second key may comprise an encryption master key (Card Data Encryption Key—Card-Key-DEK) and may be further diversified to create an ENC session key used when encrypting and decrypting enciphered data. In some examples, the first and the second keys may be created by diversifying the issuer master keys by combining them with the card's unique ID number (pUID) and the PAN sequence number (PSN) of a payment application. The pUID may comprise a 16-digit numerical value. As explained above, pUID may comprise a 16 digit BCD encoded number. In some examples, pUID may comprise a 14-digit numerical value.

In some examples, since the EMV session key derivation method may wrap at 2{circumflex over ( )}116 uses, the counter such as the full 32-bit counter may be added to the initialization arrays of the diversification method.

In other examples, for example where the mobile device may be used to authenticate transactions in place of, or in conjunction with, credit cards, a number, such as an account number or an unpredictable number provided by one or more servers, may be used for session key generation and/or diversification.

FIG. 8 illustrates a diagram of a system 800 configured to implement one or more embodiments of the present disclosure. As explained below, during the mobile device creation process, two cryptographic keys may be assigned uniquely to each mobile device. The cryptographic keys may comprise symmetric keys which may be used in both encryption and decryption of data. Triple DES (3DES) algorithm may be used by EMV and it is implemented by hardware in the mobile device. By using a key diversification process, one or more keys may be derived from a master key based upon uniquely identifiable information for each entity that requires a key.

Regarding master key management, two issuer master keys 805, 810 may be required for each part of the portfolio on which the one or more applications is issued. For example, the first master key 805 may comprise an Issuer Cryptogram Generation/Authentication Key (Iss-Key-Auth) and the second master key 810 may comprise an Issuer Data Encryption Key (Iss-Key-DEK). As further explained herein, two issuer master keys 805, 810 are diversified into card master keys 825, 830, which are unique for each card. In some examples, a network profile record ID (pNPR) 815 and derivation key index (pDKI) 820, as back office data, may be used to identify which Issuer Master Keys 805, 810 to use in the cryptographic processes for authentication. The system performing the authentication may be configured to retrieve values of pNPR 815 and pDKI 820 for a mobile device at the time of authentication.

In some examples, to increase the security of the solution, a session key may be derived (such as a unique key per session) but rather than using the master key, the unique card-derived keys and the counter may be used as diversification data, as explained above. For example, each time the card may be used in operation, a different key may be used for creating the message authentication code (MAC) and for performing the encryption. Regarding session key generation, the keys used to generate the cryptogram and encipher the data in the one or more applications may comprise session keys based on the card unique keys (Card-Key-Auth 825 and Card-Key-Dek 830). The session keys (Aut-Session-Key 835 and DEK-Session-Key 840) may be generated by the one or more applications and derived by using the application transaction counter (pATC) 845 with one or more algorithms. To fit data into the one or more algorithms, only the 2 low order bytes of the 4-byte pATC 845 may be used. In some examples, the four byte session key derivation method may comprise: F1:=PATC(lower 2 bytes)∥‘F0’∥‘00’∥PATC (four bytes) F1:=PATC(lower 2 bytes)∥‘F’∥‘00’∥PATC (four bytes) SK:={(ALG (MK) [F1])∥ALG (MK) [F2]}, where ALG may include 3DES ECB and MK may include the card unique derived master key.

As described herein, one or more MAC session keys may be derived using the lower two bytes of pATC 845 counter. At each tap, motion or other engagement with the mobile device, pATC 845 is configured to be updated, and the card master keys Card-Key-AUTH 825 and Card-Key-DEK 830 are further diversified into the session keys Aut-Session-Key 835 and DEK-Session-KEY 840. pATC 845 may be initialized to zero at personalization or application initialization time. In some examples, the pATC counter 845 may be initialized at or before personalization and may be configured to increment by one at each NDEF read.

Further, the mechanism for counter update for each contactless card emulated by the mobile device may be unique, and assigned either by personalization, or algorithmically assigned by pUID or other identifying information, such as phone numbers, EMEI numbers or the like. For example, mobile devices having odd EMEI or phone numbers may increment or decrement by 2 and mobile devices having even EMEI or phone numbers may increment or decrement by 5.

In some examples, the update may also vary in sequential reads, such that a contactless card associated counter may increment in sequence by 1, 3, 5, 2, 2, . . . repeating. The specific sequence or algorithmic sequence may be defined at personalization time, or from one or more processes derived from unique identifiers. This may make it harder for a replay attacker to generalize from a small number of card instances.

The authentication message may be delivered as the content of a text NDEF record in hexadecimal ASCII format. In some examples, only the authentication data and an 8-byte random number followed by MAC of the authentication data may be included. In some examples, the random number may precede cryptogram A and may be one block long. In other examples, there may be no restriction on the length of the random number. In further examples, the total data (i.e., the random number plus the cryptogram) may be a multiple of the block size. In these examples, an additional 8-byte block may be added to match the block produced by the MAC algorithm. As another example, if the algorithms employed used 16-byte blocks, even multiples of that block size may be used, or the output may be automatically, or manually, padded to a multiple of that block size.

The MAC may be performed by a function key (AUT-Session-Key) 835. The data specified in cryptogram may be processed with javacard.signature method: ALG_DES_MAC8_ISO9797_1_M2_ALG3 to correlate to EMV ARQC verification methods. The key used for this computation may comprise a session key AUT-Session-Key 835, as explained above. As explained above, the low order two bytes of the counter may be used to diversify for the one or more MAC session keys. As explained below, AUT-Session-Key 835 may be used to MAC data 850, and the resulting data or cryptogram A 855 and random number RND may be encrypted using DEK-Session-Key 840 to create cryptogram B or output 860 sent in the message.

In some examples, one or more HSM commands may be processed for decrypting such that the final 16 (binary, 32 hex) bytes may comprise a 3DES symmetric encrypting using CBC mode with a zero IV of the random number followed by MAC authentication data. The key used for this encryption may comprise a session key DEK-Session-Key 840 derived from the Card-Key-DEK 830. In this case, the ATC value for the session key derivation is the least significant byte of the counter pATC 845.

The format below represents a binary version example embodiment. Further, in some examples, the first byte may be set to ASCII ‘A’.

Another exemplary format is shown below. In this example, the tag may be encoded in hexadecimal format.

The UID field of the received message may be extracted to derive, from master keys Iss-Key-AUTH 805 and Iss-Key-DEK 810, the card master keys (Card-Key-Auth 825 and Card-Key-DEK 830) for that particular card. Using the card master keys (Card-Key-Auth 825 and Card-Key-DEK 830), the counter (pATC) field of the received message may be used to derive the session keys (Aut-Session-Key 835 and DEK-Session-Key 840) for that particular card. Cryptogram B 860 may be decrypted using the DEK-Session-KEY, which yields cryptogram A 855 and RND, and RND may be discarded. The UID field may be used to look up the shared secret of the contactless card emulated by the mobile device which, along with the Ver, UID, and pATC fields of the message, may be processed through the cryptographic MAC using the re-created Aut-Session-Key to create a MAC output, such as MAC'. If MAC' is the same as cryptogram A 855, then this indicates that the message decryption and MAC checking have all passed. Then the pATC may be read to determine if it is valid.

During an authentication session, one or more cryptograms may be generated by the one or more applications. For example, the one or more cryptograms may be generated as a 3DES MAC using ISO 9797-1 Algorithm 3 with Method 2 padding via one or more session keys, such as Aut-Session-Key 835. The input data 850 may take the following form: Version (2), pUID (8), pATC (4), Shared Secret (4). In some examples, the numbers in the brackets may comprise length in bytes. In some examples, the shared secret may be generated by one or more random number generators which may be configured to ensure, through one or more secure processes, that the random number is unpredictable. In some examples, the shared secret may comprise a random 4-byte binary number injected into the card at personalization time that is known by the authentication service. During an authentication session, the shared secret may not be provided from the one or more applications to the mobile application. Method 2 padding may include adding a mandatory 0x‘80’ byte to the end of input data and 0x‘00’ bytes that may be added to the end of the resulting data up to the 8-byte boundary. The resulting cryptogram may comprise 8 bytes in length.

In some examples, one benefit of encrypting an unshared random number as the first block with the MAC cryptogram, is that it acts as an initialization vector while using CBC (Block chaining) mode of the symmetric encryption algorithm. This allows the “scrambling” from block to block without having to pre-establish either a fixed or dynamic IV.

By including the application transaction counter (pATC) as part of the data included in the MAC cryptogram, the authentication service may be configured to determine if the value conveyed in the clear data has been tampered with. Moreover, by including the version in the one or more cryptograms, it is difficult for an attacker to purposefully misrepresent the application version in an attempt to downgrade the strength of the cryptographic solution. In some examples, the pATC may start at zero and be updated by 1 each time the one or more applications generates authentication data. The authentication service may be configured to track the pATCs used during authentication sessions. In some examples, when the authentication data uses a pATC equal to or lower than the previous value received by the authentication service, this may be interpreted as an attempt to replay an old message, and the authenticated may be rejected. In some examples, where the pATC is greater than the previous value received, this may be evaluated to determine if it is within an acceptable range or threshold, and if it exceeds or is outside the range or threshold, verification may be deemed to have failed or be unreliable. In the MAC operation 836, data 850 is processed through the MAC using Aut-Session-Key 835 to produce MAC output (cryptogram A) 855, which is encrypted.

In order to provide additional protection against brute force attacks exposing the keys on the mobile device, it is desirable that the MAC cryptogram 855 be enciphered. In some examples, data or cryptogram A 855 to be included in the ciphertext may comprise: Random number (8), cryptogram (8). In some examples, the numbers in the brackets may comprise length in bytes. In some examples, the random number may be generated by one or more random number generators which may be configured to ensure, through one or more secure processes, that the random number is unpredictable. The key used to encipher this data may comprise a session key. For example, the session key may comprise DEK-Session-Key 840. In the encryption operation 841, data or cryptogram A 855 and RND are processed using DEK-Session-Key 840 to produce encrypted data, cryptogram B 860. The data 855 may be enciphered using 3DES in cipher block chaining mode to ensure that an attacker must run any attacks over all of the ciphertext. As a non-limiting example, other algorithms, such as Advanced Encryption Standard (AES), may be used. In some examples, an initialization vector of 0x‘0000000000000000’ may be used. Any attacker seeking to brute force the key used for enciphering this data may be unable to determine when the correct key has been used, as correctly decrypted data may be indistinguishable from incorrectly decrypted data due to its random appearance.

FIG. 9 illustrates a method 900 which may be implemented by the emulation program coded for generating a cryptogram. For example, at block 910, a network profile record ID (pNPR) and derivation key index (pDKI) may be used to identify which Issuer Master Keys to use in the cryptographic processes for authentication. In some examples, the method may include performing the authentication to retrieve values of pNPR and pDKI for a contactless card emulated by the mobile device at the time of authentication.

At block 920, Issuer Master Keys may be diversified by combining them with the emulated contactless card unique ID number (pUID) and the PAN sequence number (PSN) of one or more applications, for example, a payment application.

At block 930, Card-Key-Auth and Card-Key-DEK (unique card keys) may be created by diversifying the Issuer Master Keys to generate session keys which may be used to generate a MAC cryptogram.

At block 940, the keys used to generate the cryptogram and encipher the data in the one or more applications may comprise the session keys of block 930 based on the emulated card unique keys (Card-Key-Auth and Card-Key-DEK). In some examples, these session keys may be generated by the one or more applications and derived by using pATC, resulting in session keys Aut-Session-Key and DEK-Session-Key.

FIG. 10 depicts an exemplary process 1000 illustrating key diversification according to one example. Initially, a sender and the recipient may be provisioned with two different master keys. For example, a first master key may comprise the data encryption master key, and a second master key may comprise the data integrity master key. The sender has a counter value, which may be updated at block 1010, and other data, such as data to be protected, which it may secure share with the recipient.

At block 1020, the counter value may be encrypted by the sender using the data encryption master key to produce the data encryption derived session key, and the counter value may also be encrypted by the sender using the data integrity master key to produce the data integrity derived session key. In some examples, a whole counter value or a portion of the counter value may be used during both encryptions.

At block 1030, the data to be protected is processed with a cryptographic MAC operation by the sender using the data integrity session key and a cryptographic MAC algorithm. The protected data, including plaintext and shared secret, may be used to produce a MAC using one of the session keys (AUT-Session-Key).

At block 1040, the data to be protected may be encrypted by the sender using the data encryption derived session key in conjunction with a symmetric encryption algorithm. In some examples, the MAC is combined with an equal amount of random data, for example each 8 bytes long, and then encrypted using the second session key (DEK-Session-Key).

At block 1050, the encrypted MAC is transmitted, from the sender to the recipient, with sufficient information to identify additional secret information (such as shared secret, master keys, etc.), for verification of the cryptogram.

At block 1060, the recipient may use the received counter value to independently derive the two derived session keys from the two master keys as explained above.

At block 1070, the data encryption derived session key may be used in conjunction with the symmetric decryption operation to decrypt the protected data. Additional processing on the exchanged data may then occur. In some examples, after the MAC is extracted, it is desirable to reproduce and match the MAC. For example, when verifying the cryptogram, it may be decrypted using appropriately generated session keys. The protected data may be reconstructed for verification. A MAC operation may be performed using an appropriately generated session key to determine if it matches the decrypted MAC. As the MAC operation is an irreversible process, the only way to verify is to attempt to recreate it from source data.

At block 1080, the data integrity derived session key may be used in conjunction with the cryptographic MAC operation to verify that the protected data has not been modified.

Some examples of the methods described herein may advantageously confirm when a successful authentication is determined when the following conditions are met. First, the ability to verify the MAC shows that the derived session key was proper. The MAC may only be correct if the decryption was successful and yielded the proper MAC value. The successful decryption may show that the correctly derived encryption key was used to decrypt the encrypted MAC. Since the derived session keys are created using the master keys known only to the sender (e.g., the transmitting device) and recipient (e.g., the receiving device), it may be trusted that the mobile device which originally created the MAC and encrypted the MAC is indeed authentic. Moreover, the counter value used to derive the first and second session keys may be shown to be valid and may be used to perform authentication operations.

Thereafter, the two derived session keys may be discarded, and the next iteration of data exchange may update the counter value (returning to block 1010) and a new set of session keys may be created (at block 1020). In some examples, the combined random data may be discarded.

FIG. 11 is a flow diagram provided to illustrate an exemplary process 1100 of using emulation program code by a mobile device to provide contactless card authentication cryptograms as described above. At step 1105, the emulation program code intercepts a contactless card authentication request received by a contactless card interface of a client device from a transaction device. At step 1110, the emulation program code identifies a contactless card associated with the contactless card authentication request, (by decoding the NFC communication, or in response to user interface of the mobile device, or other method). At step 1115, the emulation program code retrieves, from a memory of the mobile device that stores information associated with one or more contactless cards, a counter, a shared secret and a master key associated with the identified contactless card. At step 1120, the emulation program code generates a response message, the response message including at least a portion of the shared secret, or at least a portion of the counter, or both. At step 1125, the emulation program code may generating a diversified key using at least a portion of the counter, the master key and one or more cryptographic algorithm, for example as described with regard to FIGS. 7-9. At step 1130, the emulation program code encodes the response message using one or more cryptographic algorithms and the diversified key to yield a cryptogram response. At step 1135, the emulation program code forwards the cryptogram response to the NFC interface, which transmits the cryptogram response to the transaction device over the contactless card interface.

FIG. 12 illustrates an alternate embodiment of a process 1200 that may be performed by a contactless card emulation program code of a mobile device. At step 1205, the program code stores information related to one or more contactless cards in a non-volatile memory of the mobile device, the information including, for each contactless card, a pair of device keys, a counter and a shared secret. At step 1210, the program code monitors an NFC interface and intercepts a contactless card authentication request received at a contactless card interface of the mobile device from a transaction device. At step 1215, the emulation program code generates an encrypted cryptogram by first identifying a contactless card associated with the contactless card authentication request. The method next retrieves the pair of device keys, the counter and the shared secret associated with the identified contactless card at step 1225 and generates a pair of session keys using on the pair of device keys and the counter, for example using techniques described above. At step 1230, the program code generates a message using at least a portion of the shared secret, or at least a portion of the counter, or both. At step 1235, the program code encodes the message using a first session key of the pair of session keys to produce a cryptogram and at step 1240 encrypts the cryptogram using a second session key of the pair of session keys to produce an encrypted cryptogram. At step 1245, the emulation program code forwards the encrypted cryptogram to the contactless card interface for transmission to the transaction device. In one embodiment, at step 1250 the emulation program code of the mobile device displays, on a user interface of the mobile device, a status of the contactless card authentication request.

In some embodiments, the emulation program code may be used in conjunction with other authentication functions provided by the mobile device to provide dual factor authentication for transactions. For example, mobile devices generally include one or more sensors, for example a touch screen, camera, retinal scanner, thumbprint scanner, etc. that may be used to verify identify via validation of biometric information related to a user of the mobile device. In addition, mobile devices may include a keyboard, implemented as keys or a touchscreen, enabling a user to input a passcode, query response, or other factor establishing identity through knowledge. Mobile devices may also include microphones capable of recording vocal input, enabling voice recognition of pass phrase retrieval to validate user identity. In one embodiment, the mobile device may utilize one or more of such authentication methods to validate a user's identity. In one embodiment, the emulation program code may, in response to interception of a contactless card authentication request, initiate a first factor authentication request to the user, requesting that the user of the mobile device capture authentication information, such as an image capture, thumbprint, password, query response, etc. In one embodiment, the captured information may be compared by the mobile device against an expected response to authenticate the user prior to allowing the emulation program code to generate a cryptogram response. In other embodiments, the authentication response may be incorporated into the cryptogram, e.g., as part of the message prior to hashing, or to the tail of the cryptogram prior to encryption, for validation with the cryptogram by an authenticating party.

The contactless card emulation program code may be used (either alone or with second factor authentication as described above) to provide security factor authentication for a variety of purposes, including but not limited to support application or data access, to verify identity for purchases, such as at a POS device, including without limitation a kiosk, a checkout register, a payment station, or other terminal, etc.

Accordingly, a system and method that enables mobile devices (e.g. including but not limited to a mobile phone or the like), to intercept and responds to contactless card authentication requests has been described. Enabling mobile phone devices to emulate contactless cards provides numerous advantages, including but not limited to reducing issues associated with lost or damaged cards, providing the ability to use a common device to emulate multiple contactless cards and leveraging features of the device to enable dual-factor authentication.

Throughout the specification and the claims, the following terms take at least the meanings explicitly associated herein, unless the context clearly dictates otherwise. The term “or” is intended to mean an inclusive “or.” Further, the terms “a,” “an,” and “the” are intended to mean one or more unless specified otherwise or clear from the context to be directed to a singular form.

In this description, numerous specific details have been set forth. It is to be understood, however, that implementations of the disclosed technology may be practiced without these specific details. In other instances, well-known methods, structures and techniques have not been shown in detail in order not to obscure an understanding of this description. References to “some examples,” “other examples,” “one example,” “an example,” “various examples,” “one embodiment,” “an embodiment,” “some embodiments,” “example embodiment,” “various embodiments,” “one implementation,” “an implementation,” “example implementation,” “various implementations,” “some implementations,” etc., indicate that the implementation(s) of the disclosed technology so described may include a particular feature, structure, or characteristic, but not every implementation necessarily includes the particular feature, structure, or characteristic. Further, repeated use of the phrases “in one example,” “in one embodiment,” or “in one implementation” does not necessarily refer to the same example, embodiment, or implementation, although it may.

As used herein, unless otherwise specified the use of the ordinal adjectives “first,” “second,” “third,” etc., to describe a common object, merely indicate that different instances of like objects are being referred to, and are not intended to imply that the objects so described must be in a given sequence, either temporally, spatially, in ranking, or in any other manner.

While certain implementations of the disclosed technology have been described in connection with what is presently considered to be the most practical and various implementations, it is to be understood that the disclosed technology is not to be limited to the disclosed implementations, but on the contrary, is intended to cover various modifications and equivalent arrangements included within the scope of the appended claims. Although specific terms are employed herein, they are used in a generic and descriptive sense only and not for purposes of limitation.

This written description uses examples to disclose certain implementations of the disclosed technology, including the best mode, and also to enable any person skilled in the art to practice certain implementations of the disclosed technology, including making and using any devices or systems and performing any incorporated methods. The patentable scope of certain implementations of the disclosed technology is defined in the claims, and may include other examples that occur to those skilled in the art. Such other examples are intended to be within the scope of the claims if they have structural elements that do not differ from the literal language of the claims, or if they include equivalent structural elements with insubstantial differences from the literal language of the claims. 

What is claimed is:
 1. A device configured to emulate a contactless card comprising: a processor; a plurality of network interfaces including a contactless card interface; a non-volatile memory having contactless card emulation program code stored thereon, the contactless card emulation program code operable when executed upon by the processor to: detect receipt of a contactless card authentication request received at the contactless card interface from a transaction device; identify a contactless card associated with the contactless card authentication request, including retrieving, from a database storing information related to one or more contactless cards, a counter, a master key and a shared secret associated with the identified contactless card; generate a response message, the response message including at least a portion of the shared secret, or at least a portion of the counter, or both; generate a diversified key using at least a portion of the counter, the master key and one or more cryptographic algorithms; encode the response message by applying one or more cryptographic algorithms and the diversified key to the response message to yield a cryptogram response; and transmit the cryptogram response to the transaction device over contactless card interface.
 2. The device of claim 1, wherein the one or more cryptographic algorithms comprises at least one of a symmetric encryption algorithm, an HMAC algorithm, and a CMAC algorithm.
 3. The device of claim 1, wherein the contactless card interface comprises a near field communications (NFC) interface, a WIFI interface, a Bluetooth interface or an RF interface.
 4. The device of claim 1, wherein the contactless card emulation program code updates the diversified key for each cryptogram response transmission.
 5. The device of claim 4, wherein the contactless card emulation program code updates the counter associated with the identified contactless card according to a predetermined update protocol of the identified contactless card to generate the updated diversified key.
 6. The device of claim 1, wherein the contactless card emulation program periodically modifies the master key.
 7. The device of claim 1 wherein the contactless card emulation program code further includes first factor authentication program code configured to cause the device to: display an authentication prompt on a user interface of the device; capture an authentication response in response to the authentication prompt; validate the authentication response by comparing the authentication response to stored authentication data associated with an owner of the identified contactless card; and wherein the first factor authentication program code precludes production of the cryptogram response in response to a mismatch between the stored authentication data and the authentication response.
 8. The device of claim 7 wherein the authentication response includes a biometric input, an image input, a passcode, a query response, or a combination thereof.
 9. A method for emulating contactless card authentication by a client device comprising: intercepting a contactless card authentication request received by a contactless card interface of a client device from a transaction device; identifying a contactless card associated with the contactless card authentication request; retrieving, from a memory storing information associated with one or more contactless cards, a counter, a shared secret and a master key associated with the identified contactless card; generating a response message, the response message including at least a portion of the shared secret, or at least a portion of the counter, or both; generating a diversified key using at least a portion of the counter, the master key and one or more cryptographic algorithm; encoding the response message using one or more cryptographic algorithms and the diversified key to yield a cryptogram response; and transmitting the cryptogram response to the transaction device over the contactless card interface.
 10. The method of claim 9 further including the steps of: in response to receipt of the contactless card authentication request, soliciting second factor authentication information from a user of the client device, the second factor authentication information including knowledge information, biometric information, or both; and receiving a second factor authentication response from the user; comparing the second factor authentication response to an expected second factor authentication response associated with an authorized user of the identified contactless card; and selectively disabling the step of encoding the response message to generate the cryptogram response upon a mismatch between the second factor authentication response and the expected second factor authentication response.
 11. The method of claim 9, wherein the shared secret comprises a random number.
 12. The method of claim 9 including the step of modifying the counter associated with the identified contactless card according to a predetermined protocol associated with the identified contactless card for each cryptogram response generated in response to cryptogram requests associated with the identified contactless card.
 13. The method of claim 9 further including the steps of: generating an encryption key using at least a portion of the counter, the master key and one or more cryptographic algorithm, and encrypting the cryptogram response prior to transmitting the cryptogram response to the transaction device.
 14. The method of claim 13, wherein a first master key is used to generate the diversified key and a second master key is used to generate the encryption key.
 15. The method of claim 14 wherein the first master key and the second master key are each periodically updated according to different schedules.
 16. The method of claim 15 wherein the first master key comprises a network profile record identifier and the second master key comprises a derivation key index.
 17. The method of claim 9, wherein the contactless card interface comprises a Near Field Communication (NFC) interface, a Bluetooth interface, or a WiFi interface.
 18. A method for using a mobile device in place of a contactless card for contactless card authentication, the method including the steps of: storing information related to one or more contactless cards in a non-volatile memory of the mobile device, the information including, for each contactless card, a pair of device keys, a counter and a shared secret; intercepting a contactless card authentication request received at a contactless card interface of the mobile device from a transaction device; generating an encrypted cryptogram by: identifying a contactless card associated with the contactless card authentication request; retrieving the pair of device keys, the counter and the shared secret associated with the identified contactless card and generating a pair of session keys using on the pair of device keys and the counter; generating a message using at least a portion of the shared secret, or at least a portion of the counter, or both; encoding the message using a first session key of the pair of session keys to produce a cryptogram; encrypting the cryptogram using a second session key of the pair of session keys to produce an encrypted cryptogram; transmitting the encrypted cryptogram to the transaction device over the contactless card interface; and displaying, on a user interface of the mobile device, a status of the contactless card authentication request.
 19. The method of claim 18 wherein the step of generating the pair of session keys includes the steps of hashing the pair of device keys using at least a portion of the counter of the identified contactless card, and the step of encoding the message includes the step of hashing the message using the first session key.
 20. The method of claim 18 further including the steps of: displaying, on the user interface, a prompt soliciting a second factor authentication response; receiving, via a sensor of the mobile device, the second factor authentication response; comparing the second factor authentication response to an expected second factor authentication response; and selectively disabling the step of generating the encrypted cryptogram in response to a mismatch between the second factor authentication response and the expected second factor authentication response. 